package com.pshcp.patient.tool;

import com.external.pay.domain.PayReqDTO;
import com.framework.thread.ReqComHold;
import com.framework.tool.CommonTool;
import com.pshcp.common.enums.PayBusinessEnum;
import com.pshcp.common.enums.RegPayStatusEnum;
import com.pshcp.domain.dto.PatientMedicalRecordsPrintApplyDTO;
import com.pshcp.domain.model.Patient;
import com.pshcp.domain.model.PatientMedicalRecordsPrintApply;
import com.pshcp.patient.domain.medicalprint.ao.MedicalApplyAO;
import com.pshcp.patient.domain.medicalprint.ao.MedicalApplyRecordAO;
import com.pshcp.patient.domain.medicalprint.ao.MedicalApplyToPayAO;

public class MedicalPrintTools {

    public static PatientMedicalRecordsPrintApply buildPrintApplyAO2Model(MedicalApplyAO applyAO, Patient patient){
        PatientMedicalRecordsPrintApply printApply = CommonTool.copyProperties(applyAO, PatientMedicalRecordsPrintApply.class);
        printApply.setPatientUserId(ReqComHold.getReqCom().getUserId());
        printApply.setPatientName(patient.getName());
        printApply.setPayStatus(RegPayStatusEnum.WAIT_PAY.getCode());
        printApply.setApplyFlag(1);
        printApply.setBizStatus(0);
        return printApply;
    }

    public static PatientMedicalRecordsPrintApplyDTO buildApplyRecordAO2DTO(MedicalApplyRecordAO recordAO){
        PatientMedicalRecordsPrintApplyDTO applyDTO = new PatientMedicalRecordsPrintApplyDTO();
        applyDTO.setPatientId(recordAO.getPatientId());
        applyDTO.setType(recordAO.getType());
        applyDTO.setPageNum(recordAO.getPageNum());
        applyDTO.setPageSize(recordAO.getPageSize());
        return applyDTO;
    }

    public static PayReqDTO buildPayDTO(PatientMedicalRecordsPrintApply printApply, MedicalApplyToPayAO toPayAO){
        PayReqDTO payReqDTO = new PayReqDTO();
        payReqDTO.setPayMode(toPayAO.getPayMode());
        payReqDTO.setWechatType(toPayAO.getWechatType());
        payReqDTO.setOpenid(toPayAO.getOpenid());
        payReqDTO.setOrderId(printApply.getId());
        payReqDTO.setPayBusiness(PayBusinessEnum.MEDICAL_PRINT_FEE_PAY.getCode());
        payReqDTO.setAmount(printApply.getAmount());
        payReqDTO.setPatientUserId(printApply.getPatientUserId());
        return payReqDTO;
    }

}
